<?php defined('SYSPATH') or die('No direct script access.');
	
include('Zend/Soap/AutoDiscover.php');
include('Zend/Soap/Server.php');

	
	class Controller_WebService extends Controller {
		
		/**
	     * WebService controller
	     *
	     * @param void
	     * @return void
	     */
	    public function __construct()
	    {
	        Request::$instance->headers['Content-Type'] = 'text/xml; charset='.Kohana::$charset;
	    }
		
		
		/**
	     * Soap service
	     *
	     * @param void
	     * @return void
	     */
	    public function action_systoleSync()
	    {
	        // disable wsdl cache
	        ini_set('soap.wsdl_cache_enabled', '0');
	 
			$settings   = array(
								'login'         => 'user',
								'password'      => 'password',
								'authentication'=> SOAP_AUTHENTICATION_BASIC,
								'soap_version'  => SOAP_1_2,
								'encoding'      => 'UTF-8',
								'cache_wsdl'    => WSDL_CACHE_NONE
								);
	 
	        //$wsdl = 'http://' . $_SERVER['HTTP_HOST'] . '/soap/wsdl';
	        $wsdl = 'http://diastole/diastole/media/soap/systoleSync.wsdl';
	        $server = new SoapServer($wsdl, $settings);
	        $server->setClass('Model_systoleSync');
			$server->handle();
	 
	    }
	 
	    /**
	     * Soap wsdl
	     *
	     * @param void
	     * @return void
	     */
	    public function action_wsdl()
	    {
	        // disable wsdl cache
	        ini_set('soap.wsdl_cache_enabled', '0');
	 
	        $wsdl = new Zend_Soap_AutoDiscover();
	        $wsdl->setOperationBodyStyle(array('use' => 'literal','namespace' => 'http://framework.zend.com'));
	        //$wsdl->setUri('http://' . $_SERVER['HTTP_HOST'] . '/soap/service');
	        $wsdl->setUri('http://diastole/diastole/media/soap/systoleSync.wsdl');
	        $wsdl->setClass('Model_systoleSync');
	        $wsdl->handle();
	     }
	    
	    
		
	}
?>